﻿@model JuCheap.Core.Models.ViewModels.HardWareDeviceViewModel
@{
    ViewData["Title"] = "设备修改";
    Layout = "~/Views/Shared/_Layout_Content.cshtml";
}


<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5></h5>
            <div class="ibox-tools">
                <a class="collapse-link">
                    <i class="fa fa-chevron-up"></i>
                </a>
            </div>
        </div>
        <div class="ibox-content">
            <form asp-controller="HardWare" asp-action="Edit" class="form-horizontal" method="POST">
                <div class="form-group">
                    <label class="col-sm-3 control-label" asp-for="Name"></label>
                    <div class="col-sm-8">
                        <input asp-for="Name" class="form-control" placeholder="设备名称" />
                        <span asp-validation-for="Name"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" asp-for="DeviceId"></label>
                    <div class="col-sm-8">
                        <input asp-for="DeviceSn" class="form-control" placeholder="设备SN" />
                        <span asp-validation-for="DeviceId"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" asp-for="Status"></label>
                    <div class="col-sm-8">
                        <select name="Status" id="Status"
                                class="form-control" placeholder="设备状态">
                            <option value="1">在线</option>
                            <option value="2">离线</option>
                        </select>
                        <span asp-validation-for="Status"></span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label" asp-for="GroupIds"></label>
                    <div class="col-sm-8">
                        <div class="col-sm-8">
                            <select name="GroupIds" id="GroupIds"
                                    class="form-control" placeholder="组"></select>
                            <span asp-validation-for="GroupIds"></span>
                        </div>
                        <span asp-validation-for="GroupIds"></span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label" asp-for="Direction"></label>
                    <div class="col-sm-8">
                        <div class="col-sm-8">
                            <select name="Direction" id="Direction"
                                    class="form-control" placeholder="通行方向">
                                <option value="1">进</option>
                                <option value="2">出</option>
                            </select>
                            <span asp-validation-for="Direction"></span>
                        </div>
                        <span asp-validation-for="Direction"></span>
                    </div>
                </div>



                <div class="form-group">
                    <div class="col-sm-offset-3 col-sm-8">
                        <button class="btn btn-info" type="submit">保存</button>
                        <button class="btn btn-white" type="button" id="btnBack">返回</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
@section styles{
    <link href="~/js/plugins/select2/css/select2.css" rel="stylesheet" />
}

@section scripts{
    <environment names="Development">
        <script src="~/js/jquery.validate.js"></script>
        <script src="~/js/jquery.validate.unobtrusive.js"></script>
        <script src="~/js/base.js"></script>
    </environment>
    <environment names="Staging,Production">
        <script src="~/js/validate.min.js" asp-append-version="true"></script>
        <script src="~/js/base.min.js" asp-append-version="true"></script>
    </environment>
    <script src="~/js/plugins/select2/js/select2.js"></script>
    <script src="~/js/BindSelect.js"></script>
    <script>
        $("#btnBack").bind("click", function (e) {
            XPage.GoTo(e.target, "@Url.Action("Index")");
        });
        $("#Direction").val(@Model.Direction);
        $("#Status").val(@Model.Status);

        BindSelectByValue("GroupIds", "/DepartmentGroup/GetDepartmentGroups", @Model.GroupIds);

    </script>
}


